/**
 * Copyright (c) 2013-Now http://jeesite.com All rights reserved.
 */
package com.jeesite.modules.zx.course.authorization.service;

import java.util.List;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.jeesite.common.entity.Page;
import com.jeesite.common.service.CrudService;
import com.jeesite.modules.zx.course.authorization.entity.TcourseAuthorization;
import com.jeesite.modules.zx.course.authorization.dao.TcourseAuthorizationDao;
import com.jeesite.modules.file.utils.FileUploadUtils;

/**
 * 用户课程授权管理Service
 * @author zpp
 * @version 2020-02-29
 */
@Service
@Transactional(readOnly=true)
public class TcourseAuthorizationService extends CrudService<TcourseAuthorizationDao, TcourseAuthorization> {
	
	/**
	 * 获取单条数据
	 * @param tcourseAuthorization
	 * @return
	 */
	@Override
	public TcourseAuthorization get(TcourseAuthorization tcourseAuthorization) {
		return super.get(tcourseAuthorization);
	}
	
	/**
	 * 查询分页数据
	 * @param tcourseAuthorization 查询条件
	 * @param tcourseAuthorization.page 分页对象
	 * @return
	 */
	@Override
	public Page<TcourseAuthorization> findPage(TcourseAuthorization tcourseAuthorization) {
		return super.findPage(tcourseAuthorization);
	}
	
	/**
	 * 保存数据（插入或更新）
	 * @param tcourseAuthorization
	 */
	@Override
	@Transactional(readOnly=false)
	public void save(TcourseAuthorization tcourseAuthorization) {
		super.save(tcourseAuthorization);
		// 保存上传图片
		FileUploadUtils.saveFileUpload(tcourseAuthorization.getId(), "tcourseAuthorization_image");
		// 保存上传附件
		FileUploadUtils.saveFileUpload(tcourseAuthorization.getId(), "tcourseAuthorization_file");
	}
	
	/**
	 * 更新状态
	 * @param tcourseAuthorization
	 */
	@Override
	@Transactional(readOnly=false)
	public void updateStatus(TcourseAuthorization tcourseAuthorization) {
		super.updateStatus(tcourseAuthorization);
	}
	
	/**
	 * 删除数据
	 * @param tcourseAuthorization
	 */
	@Override
	@Transactional(readOnly=false)
	public void delete(TcourseAuthorization tcourseAuthorization) {
		dao.phyDelete(tcourseAuthorization);
	}
	
}